/*eslint-disable*/
import Vue from "vue";
import VueRouter from "vue-router";
import Homee from "../views/Home.vue";

Vue.use(VueRouter);

const routes = [
  {
    path: "/homee",
    name: "Homee",
    component: Homee
  },
  {
    path: "/login",
    name: "Login",
    component: () =>
      import(/* webpackChunkName: "Login" */ "../pages/Login"),
  },
  //...dynamicRoutes//不加...是[],加了是{}
  // new
  // 大屏组件
  {
    path: "/BigScreenComTest",
    name: "BigScreenComTest",
    component: () =>
      import(
        /* webpackChunkName: "BigScreenComTest" */ "../pages/BigScreenComTest/index"
        ),
  },
  // title组件
  {
    path: "/Title",
    name: "Title",
    component: () =>
      import(
        /* webpackChunkName: "TitleTest" */ "../pages/TitleTest/index"
        ),
  },
  // 获取浏览器地址参数
  {
    path: "/Url",
    name: "Url",
    component: () =>
      import(
        /* webpackChunkName: "GetUrlQuery" */ "../pages/GetUrlQuery/index"
        ),
  },
];

const router = new VueRouter({
  routes,
});


//导航到同一路径报错
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location, onResolve, onReject) {
  if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject)
  return originalPush.call(this, location).catch(err => err)
}


export default router;
